<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    {% load static %}
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>TPM</title>
    <link rel="stylesheet" href="{% static 'easyui/themes/default/easyui.css' %}" type="text/css" media="screen"/>
    <!-- <link rel="stylesheet" href="http://172.22.8.180:8080/avita_sfcs/css/main.css" type="text/css" media="screen" /> -->
    <link rel="stylesheet" type="text/css" href="{% static 'easyui/themes/icon.css' %}">
    <script src="{% static 'easyui/jquery-1.3.2.min.js' %}" type="text/javascript"></script>
    <script src="{% static 'easyui/jquery.easyui.min.js' %}" type="text/javascript"></script>

    <!--
<script src="jscript/jquery.portal.js" type="text/javascript"></script>
    -->
    <script type="text/javascript">
		$(document).ready(function(){   
		    $(document).bind("contextmenu",function(e){    
		          return false;    
		    }); 
		});
		$(function(){
                var cur_year=new Date().getFullYear();
                $("#sys_show").html("SFCS 2014~"+cur_year);
                var company=1110;
                if(company=="null"||company==null){
                  this.location.href="login.jsp";   
                }
                else{
			$('#menu1').tree({
				//url: '/user',
                                onBeforeLoad:function(){
                                  $('#menu1').html("...");
                                },
                                onLoadSuccess:function(){
                                  $('#menu1').html();
                                },
				//onClick:function(node){
                //                        addTab(node.text,node.attributes);
				//}
			});
			
			
                }
		});
		function addTab(a,b){

			var tt = $('#main-center');
			if (tt.tabs('exists', a))
			{
		    	tt.tabs('select', a);
			} 
			else
			{
		    	if (b)
		    	{
		    	    //var data1=$('#userID').val();
		    	    //var data2=$('#companyCode').val();
			    var content = '<iframe scrolling="no" frameborder="0"   src="'+ b + '" style="width:100%;height:100%;"></iframe>';
		    	} 
		    	else 
		    	{
			    	var content = 'No Content';

					//var content = '<iframe scrolling="no" frameborder="0"   src="/user" style="width:100%;height:100%;"></iframe>';
		    	}
		    	tt.tabs('add',{
			    	title:a,
			    	closable:true,
			    	content:content
		    	});
			}
		}
		function confirm(){
		$.messager.confirm('退出系统', '确定退出系统?', function(r){
			if (r){
				//alert('confirmed:'+r);
				location.href = 'login.jsp';
			}
		});
		}
		function openForum()
		{
		alert("Forum do not create!");
		
		}
		function addFavorite()
		{
                    try
                         {
                             window.external.addFavorite("http://localhost:8084/mysfcs/login.jsp","SFCS系统");
                         }
                         catch (e)
                         {
                             try
                             {
                                 window.sidebar.addPanel(sTitle, sURL, "");
                             }
                             catch (e)
                             {
                                 alert("加入收藏失败，请使用Ctrl+D进行添加");
                             }
                         }
		} 
		function checkUser(title,href,sign)
		{
		$.ajax({
			   type:"post",
			   url:"login_module.jsp",
			   data:{
			   user:$('#userID').val(),
			   company:$('#companyCode').val(),
			   sign:sign
			   },
			   dataType:"text",
		       beforeSend:function(XMLHttpRequest){
		 	     //$("#show").html("loading...");
		       },
			   success:function(data,textStatus){
			   var result=data;
                           addTab(title,href);
                           /*
                           if(result==111)
                            {
                              addTab(title,href);
                            }
                           else
                            {
                               $.messager.alert('Error', 'No privilege!', 'error');
                            }
                            */
			   },
			   error:function(msg){
			    alert(msg);
			   }  
		   }) 
	    }
            function openDocument()
            {
                    var dd=new Date().getTime();
                    var ret=window.showModalDialog("readDoc.jsp?dd="+dd,"dialogWidth:600px;dialogHeight:400px");
                
            }
            function changePwd(){
            $('#dlg').dialog('open').dialog('setTitle','密码修改');
            $('#fm').form('clear');
            }
            function modifyData(){
                var user_pwd=$("#user_pwd").val();
                var user_new_pwd=$("#user_new_pwd").val();
                var user_check_pwd=$("#user_check_pwd").val();
                if(user_pwd==""){
                    alert('请输入密码');
                    return false;
                }
                else if(user_new_pwd==""){
                    alert('请输入新密码');
                    return false; 
                }
                else if(user_check_pwd==""){
                    alert('请再次输入新密码');
                    return false;
                }
                else if(user_check_pwd != user_new_pwd){
                    alert('两次输入密码不一致');
                    return false;
                }
                else{
                   $.ajax({
                           type:"post",
                           url:"modify_user_data.jsp",
                           data:{
                           user_no:A17106,
                           user_pwd:user_pwd,
                           user_new_pwd:user_new_pwd,
                           user_check_pwd:user_check_pwd
                           },
                           dataType:"text",
                       beforeSend:function(XMLHttpRequest){
                             
                       },
                           success:function(data,textStatus){
                            alert(data);
                            $("#user_pwd").val('');
                            $("#user_new_pwd").val('');
                            $("#user_check_pwd").val('');
                           },
                           error:function(){
                            alert("error url !");
                           }  
                   })
		}
            }

    </script>

    <style>
			.nav-item{
				text-align:center;
				background:#fff;
				height:80px;
			}
			.nav-item img{
				border:0;
			}



    </style>
</head>
<body class="easyui-layout">
<div region="north" style="background:#fafaff;color:#2d5593;height:76px;">
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
            <td height="74" colspan="2" background="{% static 'images/index1_03.gif' %}">
                <table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                        <td width="33%" rowspan="2">

                            <img src="{% static 'images/avita.png' %}" width="170" height="60"/>

                        </td>
                        <td width="6%" rowspan="2">&nbsp;</td>
                        <td width="61%" height="38" align="right">
                            <table width="300" border="0" cellspacing="0" cellpadding="0">
                                <tr>
                                    <td align="center"><img src="{% static 'images/edit_remove.png' %}" width="16"
                                                            height="16"/></td>
                                    <td align="center" class="font2" width="80"><a href="#" class="font2"
                                                                                   onclick="changePwd()"><strong>变更密码</strong></a>&nbsp;|&nbsp;
                                    </td>
                                    <td align="center"><img src="{% static 'images/all.gif' %}" width="16" height="16"/>
                                    </td>
                                    <td align="center" class="font2" width="80"><a href="#" class="font2"
                                                                                   onclick="openDocument()"><strong>操作手册</strong></a>&nbsp;|&nbsp;
                                    </td>
                                    <td align="center"><img src="{% static 'images/home.png' %}" width="16"
                                                            height="16"/></td>
                                    <td align="center" class="font2" width="80"><a href="#" class="font2"
                                                                                   onclick="addFavorite()"><strong>加入最爱</strong></a>&nbsp;|&nbsp;
                                    </td>
                                    <td align="center"><img src="{% static 'images/exit.png' %}" width="16"
                                                            height="16"/></td>
                                    <td align="center" class="font2" width="80"><a href="#" class="font2"
                                                                                   onclick="confirm();"><strong>退出系统</strong></a>
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                    <tr>
                        <td align="right">
                            <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                <tr>
                                    <!--
                                      <td align="right" class="font2"><a href="#"></a>User:<input type="text" id="userID" value="A17106" style="border:0px solid" ></input>|&nbsp;Company:&nbsp;<input type="text" id="companyCode" value="1110" style="border:0px solid" ></input>&nbsp;|&nbsp;<a href="#"></a>&nbsp;</td>
                                    -->
                                    <td align="right" class="font2">
                                        <a href="#"></a>用户:<span>A17106</span
                                    ><input type="text" style="border:0px solid;display: none" id="userID"
                                            value="A17106"></input>|&nbsp;公司:&nbsp;<span>
                      1110</span><input type="text" style="border:0px solid;display: none" id="companyCode"
                                        value="1110"></input>&nbsp;|&nbsp;<a href="#"></a>&nbsp;
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>
</div>
<div region="west" title="功能菜单" split="true" style="width:180px;">
    <div class="easyui-accordion" fit="true" border="false">
        <div title="产线异常追踪系统" selected="true" style="overflow:auto;">
            <ul id="menu1" class="easyui-tree">
                <li>
                    <span>产线异常管理</span>
                    <ul>
                        <!-- <li>
                            <span>Sub Folder 1</span>
                            <ul>
                                <li><span>File 11</span></li>
                                <li><span>File 12</span></li>
                                <li><span>File 13</span></li>
                            </ul>
                        </li> -->
                        <li onclick="addTab('人员管理','user')"><span>人员管理</span></li>
                        <li onclick="addTab('产线异常','error')"><span>产线异常</span></li>
                        <li onclick="addTab('异常追踪','plan')"><span>异常追踪</span></li>
                    </ul>
                </li>

            </ul>
        </div>


    </div>
</div>
<div region="center">
    <div id="main-center" class="easyui-tabs" fit="true" border="false">

        <!-- <iframe scrolling="no" frameborder="0"   src="/user" style="width:100%;height:100%;"></iframe> -->

    </div>
</div>


</div>
<div region="south" style="background:#d2e0f2;color:#2d5593">
    <table width="100%">
        <tr>
            <td align="center" width="80%" id="sys_show">
                SFCS
            </td>
        </tr>
    </table>
</div>
<div id="dlg" class="easyui-dialog" style="width:600px;height:320px;padding:10px 20px"
     closed="true" buttons="#dlg-buttons">
    <form id="fm" method="post" novalidate>
        <div class="fitem">
            <label>密码&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label>
            <input type="text" name="user_pwd" id="user_pwd" class="easyui-validatebox" required="true"
                   style="width:200px;">
        </div>
        <hr style="border:0;background-color:#c0c0c0;height:1px">
        <div class="fitem">
            <label>新密码&nbsp;&nbsp;&nbsp;&nbsp;:</label>
            <input type="text" name="user_new_pwd" id="user_new_pwd" class="easyui-validatebox" required="true"
                   style="width:200px;">
            <span id="loadPartTip"></span>
        </div>
        <hr style="border:0;background-color:#c0c0c0;height:1px">
        <div class="fitem">
            <label>密码确认:</label>
            <input type="text" name="user_check_pwd" id="user_check_pwd" class="easyui-numberbox" required="true"
                   style="width:200px;">
        </div>
    </form>
    <hr style="height:2px;border:none;border-top:3px double blue;">
    <div id="dlg-buttons">
        <a href="#" class="easyui-linkbutton" iconCls="icon-ok" onclick="modifyData()">修改保存</a>
    </div>
</div>
</body>
</html>
